//
//  MainViewController.m
//  Miss
//
//  Created by Alan on 15/1/28.
//  Copyright (c) 2015年 Alan. All rights reserved.
//

#import "MainViewController.h"
#import "TitleTableViewCell.h"
#import "LaberTableViewCell.h"
#import "PlayerTableViewCell.h"
@interface MainViewController ()<UITableViewDataSource,UITableViewDelegate,CDSideBarControllerDelegate>

{
    CDSideBarController *sideBar;//边栏
}
@end

@implementation MainViewController
- (void)dealloc{
    [_arr1 release];
    [_tabel1 release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"Main";
    //边栏
    NSArray *imageList = @[[UIImage imageNamed:@"Sundayc.png"], [UIImage imageNamed:@"mondayc.png"], [UIImage imageNamed:@"Tuesdayc.png"],[UIImage imageNamed:@"Wednesdayc.png"] ,[UIImage imageNamed:@"Thursdayc.png"] , [UIImage imageNamed:@"Fridayc.png"], [UIImage imageNamed:@"Saturdayc.png"]];
    sideBar = [[CDSideBarController alloc] initWithImages:imageList];
    sideBar.delegate = self;

    // Do any additional setup after loading the view.
    self.arr1 = [NSMutableArray arrayWithObjects:@"3",nil];
    self.tabel1 = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.tabel1.separatorStyle = NO;//去横线
    self.tabel1.delegate = self;
    self.tabel1.dataSource = self;
    
    [self.view addSubview:self.tabel1];
    [_tabel1 release];
}
//cell数量
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}
//高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0 ) {
        return 400;
    }else if(indexPath.row == 1){
        return 90;
    }else if (indexPath.row == 2){
        return 100;
    }
    
    return 150;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        static NSString *str = @"aa";
        TitleTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
        if (cell == nil) {
            cell = [[[TitleTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:str] autorelease];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            
        }
        return cell;
    }else if(indexPath.row == 1){
        static NSString *str = @"bb";
        LaberTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
        if (cell == nil) {
            cell = [[[LaberTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:str] autorelease];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
        return cell;
    }else if(indexPath.row == 2){
        static NSString *str = @"cc";
        PlayerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
        if (cell == nil) {
            cell = [[[PlayerTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:str] autorelease];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
        return cell;
    }
    else{
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"asds"];
        
        if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"asd"] autorelease];
            
        }
        return cell;
    }

}
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    [sideBar insertMenuButtonOnView:self.view];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
